<%--
  Created by IntelliJ IDEA.
  User: Noodles
  Date: 2018/1/11
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>

    <style>
        input{
            border: none;
            background-color: inherit;
            color: black;
            text-align: center;
            font-size: medium;
        }
    </style>


</head>
<body>

<h1 style="font-family: 楷体;font-size: 26px">查看课程信息</h1>
<table border="1" cellpadding="10" cellspacing="0" width="50%" style="text-align: center;" align="center">

    <tr>

        <td>课 程 号</td>
        <td>课 程 名</td>
        <td>任课教师</td>
        <td></td>

    </tr>


    
    <c:forEach var="temp" items="${requestScope.allClassInfo}">
        
        <tr>

            <%--<td>${temp.value.getCno()}</td>--%>

            <td>
                <input type="text" class="${temp.value.getCno()}" readonly=true value="${temp.value.getCno()}">
            </td>

            <td><input type="text" class="${temp.value.getCno()}" readonly=true value="${temp.value.getCname()}"></td>
            <td><input type="text" class="${temp.value.getCno()}" readonly=true value="${temp.key.getUname()}"></td>



            <td>
                <div>
                    <input type="button"  style="display: block"  id="${temp.value.getCno()}1"  name="update2" value="修改" onclick="a(${temp.value.getCno()})">
                </div>
                <a>
                    <input type="button"  id="${temp.value.getCno()}" style="display: none"  value="确定"
                           onclick="b(${temp.value.getCno()},${temp.value.getCname()},${temp.key.getUname()})">
                </a>

            </td>
        </tr>
        
    </c:forEach>


</table>


<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>

<script type="text/javascript">

    function a(obj) {

        $("."+obj).prop("readonly",false);
        $("."+obj).css("background","#CCCCCC");

        $("#"+obj+"1").css("display","none");
        $("#"+obj).css("display","block");

/*        $("div,#"+obj).css("display","none");
        $("a,#"+obj).css("display","block");*/
    }

    function b(obj,obj1,obj2) {

        alert("11111");
        $.get("/updateClassInfo",{
            obj:"cno",
            obj1:"cname",
            obj2:"uname"
        });


        alert("22222");

        $("."+obj).prop("readonly",true);
        $("."+obj).css("background","inherit");

        $("#"+obj).css("display","none");
        $("#"+obj+"1").css("display","block");

/*        $("div,#"+obj).css("display","block");
        $("a,#"+obj).css("display","none");*/
    }

</script>

</body>
</html>
